extends NodeState


@export var player: Player


var collectible: Collectible


func _on_process(_delta : float) -> void:
	pass


func _on_physics_process(_delta : float) -> void:
	pass


func _on_next_transitions() -> void:
	pass


func _on_enter() -> void:
	collectible = null
	pickup_collectible()


func _on_exit() -> void:
	pass



func pickup_collectible():
	collectible = player.try_pickup_collectible()
	if collectible != null:
		player.animationPlayer.play(Player.ANIMATION_PICKUP)
		player.pickup_collectible(collectible)
	else:
		transition_state(Player.STATE_IDLE)



func on_pickup_animation_finished():
	transition_state(Player.STATE_IDLE)
